<%-- 
  - Author: Ismail Basha
  - Date: 4-Jan-'2012
  - Copyright Notice: TRAKHEES
  - Description: list.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>

<script type="text/javascript">
		$()
				.ready(
						function() {

							//$("input:submit, input:reset, input:button, input:file").button();

							$("#ProfileUpdate")
									.validate(
											{
												onfocusout : false,
												onkeyup : false,
												rules : {
													strPassword : {
														required : true,
														minlength : 8,
														maxlength : 12
													},
													strConfirmPassword : {
														required : true,
														equalTo : "#strPassword"
													}
												},
												showErrors : function(errorMap,
														errorList) {

													var errors = '<ul>';
													var label;
													if (errorList.length) {
														$.each(errorMap, function(
																name, value) {
															label = $(
																	"label[for='"
																			+ name
																			+ "']")
																	.html();
															label = value + '['
																	+ label + ']';
															errors = errors
																	+ '<li>'
																	+ label
																	+ '</li>';

														});
														errors = errors + '</ul>';
														jAlert('error', errors,
																'<spring:message code="label.errormessage" />');
													}
												}

											});

						});
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>

	<form:form name="ProfileUpdate" id="ProfileUpdate" method="POST"
		enctype="multipart/form-data"
		modelAttribute="<%=ConstantsAdmin.USER_PERSON_INFO_MODEL_KEY%>">


		<spring:hasBindErrors name="<%=ConstantsAdmin.USER_PERSON_INFO_MODEL_KEY%>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<div class="ui-widget_c ui-corner-all t_fin-black-txt">
			<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
				<spring:message code="label.menu.update.user.profile" />
			</div>
			<fieldset>
				<legend>
					<spring:message code="label.login.details" />
				</legend>
			</fieldset>			
			<div class="ui-widget_content_c t_form-left">
					<div class="fm-req">
						<form:label path="strPersonNameENG">
							<spring:message code="label.empname.eng" />
						</form:label>
						<form:input path="strPersonNameENG" id="strClientPersonNameENG"
							size="20" maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strPersonNameARB">
							<spring:message code="label.empname.arab" />
						</form:label>
						<form:input path="strPersonNameARB" id="strClientPersonNameARB"
							size="20" maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strUserName">
							<spring:message code="label.client.person.register.user.name" />
						</form:label>
						<form:input path="strUserName" id="strUserName" size="20"
							maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strPassword">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.password" />
						</form:label>
						<form:password path="strPassword" id="strPassword" size="20"
							maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strConfirmPassword">
						<span class="t_star">*</span>
							<spring:message
								code="label.client.person.register.confirmPassword" />
						</form:label>
						<form:password path="strConfirmPassword" id="strConfirmPassword"
							size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="iSecQuestion">
							<spring:message code="label.secretquestion" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelAr" itemValue="id"
									disabled="true" class="fm-opt"/>
							</c:when>
							<c:otherwise>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelEn" itemValue="id"
									disabled="true" class="fm-opt"/>
							</c:otherwise>
						</c:choose>		
					</div>
					<div class="fm-req">
						<form:label path="strSecretAnswer">
							<spring:message code="label.client.person.register.secretAnswer" />
						</form:label>
						<form:input path="strSecretAnswer" id="strSecretAnswer" size="20"
							maxlength="100" readonly="true" />
					</div>

					<div class="fm-req">
						<form:label path="strEmailAddress">
							<spring:message code="label.client.person.register.emailAddress" />
						</form:label>
						<form:input path="strEmailAddress" id="strEmailAddress" size="20"
							maxlength="100" readonly="true" />
					</div>

					<div class="fm-req">
						<form:label path="strMobileNo">
							<spring:message code="label.client.person.register.mobNo" />
						</form:label>
						<form:input path="strMobileNo" id="strMobileNo" size="20"
							maxlength="100" readonly="true" />
					</div>
					<div style="display:none;">
						<form:label path="strMobileNotification">
							<spring:message code="label.client.person.register.notifications" />
						</form:label>
						<div class="fm-multi">
							<spring:message code="label.emailnotification" />
							<form:checkbox path="strEmailNotification" value="Y"
								id="strEmailNotification" disabled="true" class="opt-input"/>
							<spring:message code="label.smsnotification" />
							<form:checkbox path="strMobileNotification" value="Y"
								id="strMobileNotification" disabled="true" class="opt-input"/>
						</div>					
					</div>

					<div>
						<div id="tableServiceListWrapper">
							<b><spring:message code="label.service" /></b>
							<table id="serviceListTable" class="t_grid-table" width="100%" >
								<caption>
									<spring:message code="label.service.subscribed" />
								</caption>
								<thead>
									<tr class="odd ui-jqgrid-labels">
										<th width="200px" class="ui-state-default ui-th-column ui-th-ltr"><spring:message
												code="label.service.name.en" />
										</th>
										<th width="200px" class="ui-state-default ui-th-column ui-th-ltr"><spring:message
												code="label.service.name.ar" />
										</th>
									</tr>
								</thead>
								<tbody>
									<c:if test="${not empty employeeServiceList}">

										<c:forEach items="${employeeServiceList}" var="service"
											varStatus="loop">
											<tr>
												<td><form:hidden path="arrServices"
														label="${service.strServiceNameArb}"
														value="${service.strServiceID}" />
												<c:out value="${service.strServiceNameEng}"></c:out>
												</td>
												<td><c:out value="${service.strServiceNameArb}"></c:out>
												</td>
											</tr>

										</c:forEach>
									</c:if>
								</tbody>
							</table>
						</div>
						<c:if test="${empty employeeServiceList}">
							<script>
								$("#tableServiceListWrapper").hide();
							</script>
						</c:if>
					</div>

				<div id="fm-submit" class="fm-req">
						<input
						type="submit" name="submit"
						value="<spring:message code="label.button.submit" />" class="t_btns submit"/>
				
						<input type="reset" name="reset"
						value="<spring:message code="label.button.reset" />" class="t_btns reset"/> 
				</div>
				</fieldset>
			</div>
		</div>
	</form:form>
</div>